package cn.mxb.logic.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import cn.mxb.floor.dao.impl.BaseDaoImpl;
import cn.mxb.logic.entity.SysUser;

@Repository("loginDAO")
public class LoginDAO extends BaseDaoImpl<SysUser>{

	/**
	 * 根据property值查询
	 * @param property
	 * @param value
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public SysUser findByProperty(String property, String value) {
		List<SysUser> list = null;
		SysUser sysUser = null;
		String hql = "from SysUser where "+property+" like '%"+value+"%' ";
		try{
			 list = this.getHibernateTemplate().find(hql);
			   if(list.size()>0 && list !=null){
				   sysUser = list.get(0);
			   }else{
				   System.out.println("提示用户为空");
			   }
		}catch(Exception e){
			System.out.println(e);
		}
		return sysUser;
	}
}
